package com.candy.control;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

@WebServlet("/shoplist")
public class ShoppingListServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//        获取Session对象
        HttpSession session= req.getSession();
//        从Session中获取购物车信息
        String[] shoplist=(String[]) session.getAttribute("shopcar");
        for (String bookinfo:shoplist){
            resp.getWriter().println(bookinfo);
        }
    }
}
